﻿/// Write a program that reads two integer numbers N and K and an array of N elements from the console. 
/// Find in the array those K elements that have maximal sum.

using System;

class zad6
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int K = int.Parse(Console.ReadLine());

        int[] arr = new int[N];

        for (int i = 0; i < N; i++)
        {
            arr[i] = int.Parse(Console.ReadLine());
        }

        //int[] arr = { 2, 3, 4, 5, 6, 3, 4};
        //int N = 7;
        //int K = 4;

        int sum = 0;
        int bestSum = 0;
        //  { 2, 3, 4, 5, 6, 3, 4};
        for (int i = 0; i <= N - K; i++)
        {
            if (K + i <= N)
            {
                for (int j = i; j < K+i; j++)
                {
                    sum += arr[j];
                } 
            }

            if (bestSum < sum)
            {
                bestSum = sum;
            }

            sum = 0;
        }

        Console.WriteLine(bestSum);
    }
}
